﻿/*************************************************************************
 * 
 * Filename :message
 * 
 * steven hu   2010/3/11 15:20:04
 *  
 * http://www.cnblogs.com/huxj
 *   
 * 
 * Change History:
 * 
 * 
**************************************************************************/



using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Hxj.Data;
using Hxj.Web;
using Hxj.Common;
using RicciWebsite.Model;

namespace RicciWebsite.admin
{
    public partial class message : RicciWebsite.Pages.AdminPage
    {

        /// <summary>
        /// 留言ID
        /// </summary>
        protected Guid? mid;

        protected void Page_Load(object sender, EventArgs e)
        {
            string tempid = Request.QueryString["mid"];
            if (Validator.IsGuid(tempid))
            {
                mid = new Guid(tempid);
            }

            if (mid.HasValue)
            {
                base_message messageModel = RicciDatabase.Default.From<base_message>().Where(base_message._.mid == mid.Value.ToString()).ToFirst();

                if (null != messageModel)
                {
                    llemail.Text = messageModel.email;
                    llmcontent.Text = messageModel.mcontent;
                    llmtitle.Text = messageModel.mtitle;
                    llsubtime.Text = messageModel.subtime.ToString();
                    lluname.Text = messageModel.uname;
                    llip.Text = messageModel.subip;
                    if (messageModel.status == 0)
                    {
                        //更新已读
                        RicciDatabase.Default.Update<base_message>(base_message._.status, 1, base_message._.mid == mid.Value.ToString());
                    }

                    return;
                }
            }

            JavaScript.Close();


        }
    }
}
